/*
 *
 * Copyright (c) 2014-2017 Daniele Lenares (https://github.com/dnlnrs)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version 1.1.3
 *
 */
(function(a){'use strict';function b(d,e,f){'show'===e?'fade'===f?d.fadeIn():'slide'===f?d.slideDown():d.fadeIn():'fade'===f?d.fadeOut():'slide'===f?d.slideUp():d.fadeOut()}function c(d,e){var f=!0;d.on('click',function(){!0==f&&(f=!1,a('html, body').animate({scrollTop:0},e,function(){f=!0}))})}a.goup=function(d){var e=a.extend({location:'right',locationOffset:20,bottomOffset:10,containerSize:40,containerRadius:10,containerClass:'goup-container',arrowClass:'goup-arrow',alwaysVisible:!1,trigger:500,entryAnimation:'fade',goupSpeed:'slow',hideUnderWidth:500,containerColor:'#000',arrowColor:'#fff',title:'',titleAsText:!1,titleAsTextClass:'goup-text',zIndex:1},d);'right'!==e.location&&'left'!==e.location&&(e.location='right'),0>e.locationOffset&&(e.locationOffset=0),0>e.bottomOffset&&(e.bottomOffset=0),20>e.containerSize&&(e.containerSize=20),0>e.containerRadius&&(e.containerRadius=0),0>e.trigger&&(e.trigger=0),0>e.hideUnderWidth&&(e.hideUnderWidth=0);var f=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;f.test(e.containerColor)||(e.containerColor='#000'),f.test(e.arrowColor)||(e.arrowColor='#fff'),''===e.title&&(e.titleAsText=!1),isNaN(e.zIndex)&&(e.zIndex=1);var g=a('body'),h=a(window),i=a('<div>');i.addClass(e.containerClass);var j=a('<div>');j.addClass(e.arrowClass),i.html(j),g.append(i);var k={position:'fixed',width:e.containerSize,height:e.containerSize,background:e.containerColor,cursor:'pointer',display:'none','z-index':e.zIndex};if(k.bottom=e.bottomOffset,k[e.location]=e.locationOffset,k['border-radius']=e.containerRadius,i.css(k),!e.titleAsText)i.attr('title',e.title);else{var l=a('<div>');g.append(l),l.addClass(e.titleAsTextClass).text(e.title),l.attr('style',i.attr('style')),l.css('background','transparent').css('width',e.containerSize+40).css('height','auto').css('text-align','center').css(e.location,e.locationOffset-20);var m=parseInt(l.height())+10,n=parseInt(i.css('bottom'));i.css('bottom',m+n)}var p=0.25*e.containerSize,q={width:0,height:0,margin:'0 auto','padding-top':Math.ceil(0.325*e.containerSize),'border-style':'solid','border-width':'0 '+p+'px '+p+'px '+p+'px','border-color':'transparent transparent '+e.arrowColor+' transparent'};j.css(q);var r=!1;h.resize(function(){h.outerWidth()<=e.hideUnderWidth?(r=!0,b(i,'hide',e.entryAnimation),'undefined'!=typeof l&&b(l,'hide',e.entryAnimation)):(r=!1,h.trigger('scroll'))}),h.outerWidth()<=e.hideUnderWidth&&(r=!0,i.hide(),'undefined'!=typeof l&&l.hide()),e.alwaysVisible?(b(i,'show',e.entryAnimation),'undefined'!=typeof l&&b(l,'show',e.entryAnimation)):h.scroll(function(){h.scrollTop()>=e.trigger&&!r&&(b(i,'show',e.entryAnimation),'undefined'!=typeof l&&b(l,'show',e.entryAnimation)),h.scrollTop()<e.trigger&&!r&&(b(i,'hide',e.entryAnimation),'undefined'!=typeof l&&b(l,'hide',e.entryAnimation))}),h.scrollTop()>=e.trigger&&!r&&(b(i,'show',e.entryAnimation),'undefined'!=typeof l&&b(l,'show',e.entryAnimation)),c(i,e.goupSpeed),'undefined'!=typeof l&&c(l,e.goupSpeed)}})(jQuery);